package com.wwx.worldonwheels.controller;

import com.wwx.worldonwheels.common.result.CommonResult;
import com.wwx.worldonwheels.service.CarRentalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: CarRentalController
 * Description:
 * CreatedBy: HuaHX
 */
@RestController
public class CarRentalController {
    @Autowired
    private CarRentalService carRentalService;

    @RequestMapping(value = "/ListCar", method = RequestMethod.POST)
    public CommonResult listCar(String orderBy) {
        return carRentalService.ListCar(orderBy);
    }
    @RequestMapping(value = "/ListService", method = RequestMethod.POST)
    public CommonResult listService(String id) {
        return carRentalService.ListService(id);
    }
    @RequestMapping(value = "/FindCar")
    public CommonResult findCar(@RequestParam(value = "vehicleClass") Integer vehicleClass) {
        return carRentalService.FindCar(vehicleClass);
    }

    @RequestMapping(value = "/BorrowCar", method = RequestMethod.POST)
    public Object borrowCar(@RequestParam(value = "phone") String phone,
                                  @RequestParam(value = "vin") String vin) {

        return carRentalService.BorrowCar(phone, vin);
    }
    @RequestMapping(value = "/findCoupon", method = RequestMethod.POST)
    public CommonResult findCoupon(Integer id) {
        return carRentalService.findCoupon(id);
    }
}
